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S( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 0 )
};


static const uint32_t BIG5_st [ 3] = {
  PCK4BITS( eError, eStart, eStart,     3, eError, eError, eError, eError ),
  PCK4BITS( eError, eError, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eError ),
  PCK4BITS( eError, eStart, eStart, eStart, eStart, eStart, eStart, eStart )
};

static const uint32_t Big5CharLenTable[] = {0, 1, 1, 2, 0};

SMModel const Big5SMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls },
  5,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_st },
  CHAR_LEN_TABLE( Big5CharLenTable ),
  "Big5",
};

static const uint32_t EUCJP_cls [ 256 / 8 ] = {

  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 5, 5 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 5, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 1, 3 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 5 )
};


static const uint32_t EUCJP_st [ 5] = {
  PCK4BITS( 3,     4,     3,     5, eStart, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eItsMe, eItsMe, eItsMe, eItsMe ),
  PCK4BITS( eItsMe, eItsMe, eStart, eError, eStart, eError, eError, eError ),
  PCK4BITS( eError, eError, eStart, eError, eError, eError,     3, eError ),
  PCK4BITS( 3, eError, eError, eError, eStart, eStart, eStart, eStart )
};

static const uint32_t EUCJPCharLenTable[] = {2, 2, 2, 3, 1, 0};

const SMModel EUCJPSMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_cls },
  6,
  {eIdxSft4bits, e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2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 0 )
};


static const uint32_t EUCKR_st [ 2] = {
  PCK4BITS( eError, eStart,     3, eError, eError, eError, eError, eError ),
  PCK4BITS( eItsMe, eItsMe, eItsMe, eItsMe, eError, eError, eStart, eStart )
};

static const uint32_t EUCKRCharLenTable[] = {0, 1, 2, 0};

const SMModel EUCKRSMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_cls },
  4,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_st },
  CHAR_LEN_TABLE( EUCKRCharLenTable ),
  "EUC-KR",
};

static const uint32_t EUCTW_cls [ 256 / 8 ] = {

  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 0, 0 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 0, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 6, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 ),
  PCK4BITS( 0, 3, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 5, 5, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 3, 1, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 0 )
};


static const uint32_t EUCTW_st [ 6] = {
  PCK4BITS( eError, eError, eStart,     3,     3,     3,     4, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError, eItsMe, eItsMe ),
  PCK4BITS( eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eError, eStart, eError ),
  PCK4BITS( eStart, eStart, eStart, eError, eError, eError, eError, eError ),
  PCK4BITS( 5, eError, eError, eError, eStart, eError, eStart, eStart ),
  PCK4BITS( eStart, eError, eStart, eStart, eStart, eStart, eStart, eStart )
};

static const uint32_t EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3};

const SMModel EUCTWSMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_cls },
  7,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_st },
  CHAR_LEN_TABLE( EUCTWCharLenTable ),
  "x-euc-tw",
};




static const uint32_t GB18030_cls [ 256 / 8 ] = {
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 0, 0 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 0, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 4 ),
  PCK4BITS( 5, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 6 ),
  PCK4BITS( 6, 6, 6, 6, 6, 6, 6, 0 )
};


static const uint32_t GB18030_st [ 6] = {
  PCK4BITS( eError, eStart, eStart, eStart, eStart, eStart,     3, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError, eItsMe, eItsMe ),
  PCK4BITS( eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eError, eError, eStart ),
  PCK4BITS( 4, eError, eStart, eStart, eError, eError, eError, eError ),
  PCK4BITS( eError, eError,     5, eError, eError, eError, eItsMe, eError ),
  PCK4BITS( eError, eError, eStart, eStart, eStart, eStart, eStart, eStart )
};


static const uint32_t GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2};

const SMModel GB18030SMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_cls },
  7,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_st },
  CHAR_LEN_TABLE( GB18030CharLenTable ),
  "GB18030",
};


static const uint32_t SJIS_cls [ 256 / 8 ] = {

  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 0, 0 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 0, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 1 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),


  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 0, 0, 0 )
};


static const uint32_t SJIS_st [ 3] = {
  PCK4BITS( eError, eStart, eStart,     3, eError, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eItsMe, eItsMe, eItsMe, eItsMe ),
  PCK4BITS( eItsMe, eItsMe, eError, eError, eStart, eStart, eStart, eStart )
};

static const uint32_t SJISCharLenTable[] = {0, 1, 1, 2, 0, 0};

const SMModel SJISSMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_cls },
  6,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_st },
  CHAR_LEN_TABLE( SJISCharLenTable ),
  "Shift_JIS",
};


static const uint32_t UTF8_cls [ 256 / 8 ] = {
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 0, 0 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 0, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 1, 1, 1, 1, 1, 1, 1, 1 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 2, 2, 2, 2, 2, 2, 2, 2 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 3, 3, 3, 3, 3, 3, 3, 3 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 4, 4, 4, 4, 4, 4, 4, 4 ),
  PCK4BITS( 0, 0, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 5, 5, 5, 5, 5, 5, 5, 5 ),
  PCK4BITS( 6, 7, 7, 7, 7, 7, 7, 7 ),
  PCK4BITS( 7, 7, 7, 7, 7, 8, 7, 7 ),
  PCK4BITS( 9, 10, 10, 10, 11, 0, 0, 0 ),
  PCK4BITS( 0, 0, 0, 0, 0, 0, 0, 0 )
};


static const uint32_t UTF8_st [ 15] = {
  PCK4BITS( eError, eStart, eError, eError, eError,     3,     4,     5 ),
  PCK4BITS( 6,     7,     8,     9, eError, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError, eError, eError ),
  PCK4BITS( eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe ),
  PCK4BITS( eItsMe, eItsMe, eItsMe, eItsMe, eError, eError, eStart, eStart ),
  PCK4BITS( eStart, eError, eError, eError, eError, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError,     3, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError,     3,     3 ),
  PCK4BITS( 3, eError, eError, eError, eError, eError, eError, eError ),
  PCK4BITS( eError, eError,     3,     3, eError, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError,     5,     5 ),
  PCK4BITS( eError, eError, eError, eError, eError, eError, eError, eError ),
  PCK4BITS( eError, eError,     5,     5,     5, eError, eError, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError,     5, eError ),
  PCK4BITS( eError, eError, eError, eError, eError, eError, eError, eError )
};

static const uint32_t UTF8CharLenTable[] = {0, 1, 0, 0, 0, 2, 3, 3, 3, 4, 4, 4};

const SMModel UTF8SMModel = {
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_cls },
  12,
  {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_st },
  CHAR_LEN_TABLE( UTF8CharLenTable ),
  "UTF-8",
};
